package com.initialize.pub.generate.dao;

import com.initialize.pub.generate.pojo.Comments;
import com.initialize.pub.generate.pojo.CommentsExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface CommentsMapper {
    @SelectProvider(type=CommentsSqlProvider.class, method="countByExample")
    long countByExample(CommentsExample example);

    @DeleteProvider(type=CommentsSqlProvider.class, method="deleteByExample")
    int deleteByExample(CommentsExample example);

    @Delete({
        "delete from comments",
        "where cid = #{cid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer cid);

    @Insert({
        "insert into comments (cid, aid, ",
        "ccid, name, email, ",
        "content, add_the_time, ",
        "status)",
        "values (#{cid,jdbcType=INTEGER}, #{aid,jdbcType=INTEGER}, ",
        "#{ccid,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, ",
        "#{content,jdbcType=VARCHAR}, #{addTheTime,jdbcType=TIMESTAMP}, ",
        "#{status,jdbcType=INTEGER})"
    })
    int insert(Comments record);

    @InsertProvider(type=CommentsSqlProvider.class, method="insertSelective")
    int insertSelective(Comments record);

    @SelectProvider(type=CommentsSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="cid", property="cid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="aid", property="aid", jdbcType=JdbcType.INTEGER),
        @Result(column="ccid", property="ccid", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="add_the_time", property="addTheTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    List<Comments> selectByExample(CommentsExample example);

    @Select({
        "select",
        "cid, aid, ccid, name, email, content, add_the_time, status",
        "from comments",
        "where cid = #{cid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="cid", property="cid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="aid", property="aid", jdbcType=JdbcType.INTEGER),
        @Result(column="ccid", property="ccid", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="add_the_time", property="addTheTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    Comments selectByPrimaryKey(Integer cid);

    @UpdateProvider(type=CommentsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Comments record, @Param("example") CommentsExample example);

    @UpdateProvider(type=CommentsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Comments record, @Param("example") CommentsExample example);

    @UpdateProvider(type=CommentsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Comments record);

    @Update({
        "update comments",
        "set aid = #{aid,jdbcType=INTEGER},",
          "ccid = #{ccid,jdbcType=INTEGER},",
          "name = #{name,jdbcType=VARCHAR},",
          "email = #{email,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=VARCHAR},",
          "add_the_time = #{addTheTime,jdbcType=TIMESTAMP},",
          "status = #{status,jdbcType=INTEGER}",
        "where cid = #{cid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Comments record);
}